package sivan.test;

import org.junit.Test;

import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author : xiaowen
 * @create: 2020-10-12 21:26
 */
public class JavaSoftDemo {

    @Test
    public void soft() {
        List<SoftReference<String>> list = new ArrayList<>();
        for (int i = 0; i < 5; i++){
            SoftReference<String> softReference = new SoftReference<>("xiaowen");
            list.add(softReference);
        }

        list.forEach(x-> System.out.println(x.get()));
    }
}
